package cool.webstudy.admin.constant.enums.rescode;

import lombok.extern.slf4j.Slf4j;

/**
 * 作者：陈先生
 * 日期：2024/8/5
 * 描述:
 */
@Slf4j
public enum DictDataResCodeEnum implements BaseResCodeEnum{
    RC_ERROR_CREATE("30001","创建字典值失败"),
    RC_ERROR_DELETE("30002","删除字典值失败！"),
    RC_ERROR_UPDATE("30003","更新字典值失败！"),
    ;

    String code;
    String msg;
    DictDataResCodeEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    @Override
    public String code() {
        return code;
    }

    @Override
    public String msg() {
        return msg;
    }

    public static DictDataResCodeEnum getMsgByCode(String code){
        for (DictDataResCodeEnum dictDataResCodeEnum : DictDataResCodeEnum.values()) {
            if (dictDataResCodeEnum.code().equals(code)){
                return dictDataResCodeEnum;
            }
        }
        log.error("getMsgByCode 无法获取枚举值");
        return null;
    }
}
